package com.yanqu.road.entity.monopolymarket.resgrab;


import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description 榷场资源争夺战
 * @Author cwq
 * @Data 2021/8/12 10:32
 */
public class MonopolyMarketResGrab {

    /**
     * 类型
     */
    public int type;

    /**
     * 地图信息
     */
    public MonopolyMarketResGrabMap map;

    /**
     * 位置信息 k:index
     */
    public Map<Integer, MonopolyMarketResGrabPointInfo> pointsMap = new ConcurrentHashMap<>();

    /**
     *  需要update 和add 的seatInfo 改完删除
     */
    public Set<MonopolyMarketResGrabPointInfo> updateAndAddPointInfoSet = new HashSet<>();

    /**
     * 玩家占领的据点集合
     */
    public Map<Long,Set<MonopolyMarketResGrabPointInfo>> userPointMap = new ConcurrentHashMap<>();

    /**
     * 正在采集的据点 定时器要用
     */
    public List<MonopolyMarketResGrabPointInfo> collectingPointInfoList = new ArrayList<>();
    /**
     * 当前采集点最近的结算时间
     */
    public volatile int minResGrabEndTime = 0;

    /**
     * 玩家 当前正在查看的据点
     */
    public Map<Long,Integer> userInPointMap = new ConcurrentHashMap<>();

    public MonopolyMarketResGrab(int type) {
        this.type = type;
    }

    public Set<MonopolyMarketResGrabPointInfo> getUserPointSet(long userId,boolean newIfNull){
        Set<MonopolyMarketResGrabPointInfo> set = userPointMap.get(userId);
        if(set == null && newIfNull){
            set = new HashSet<>();
            userPointMap.put(userId,set);
        }
        return set;
    }

}
